package com.gkd.dao;


import com.gkd.pojo.Department;
import com.gkd.pojo.LoginUser;
import com.gkd.service.DepartmentService;
import com.gkd.service.LoginUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class LoginUserDao {
    @Autowired
    LoginUserService loginUserService;
    public Map<Integer,LoginUser> flm = new HashMap<>();
    public Map<Integer,LoginUser> fsnlm = new HashMap<>();

    public Map<Integer, LoginUser> LoginUserMap() {
        List<LoginUser> ls=loginUserService.queryAllLoginUser();
        for(int i =0; i<ls.size();i++){
            flm.put(i,ls.get(i));
//            flm.put(ls.get(i).getId(),ls.get(i));
        }
        return flm;
    }

    public Map<Integer, LoginUser> sameNameLoginUserMap(String name) {
        List<LoginUser> ls=loginUserService.querlAllsameNameUser(name);
        for(int i =0; i<ls.size();i++){
//            fsnlm.put(ls.get(i).getId(),ls.get(i));
            fsnlm.put(i,ls.get(i));
        }
        return fsnlm;
    }


}
